package com.code.day18JiHe.Collections;

import java.util.ArrayList;
import java.util.Collections;

public class Demo02 {
    public static void main(String[] args) {
        ArrayList<Person> list = new ArrayList<>();
        list.add(new Person("小龙女", 18));
        list.add(new Person("碎碎念", 22));
        list.add(new Person("李寒衣", 20));


//        Collections.sort(list, (o1, o2) -> o2.getAge() - o1.getAge());
        Collections.sort(list);
        System.out.println(list);
    }
}
